package com.ean.backpack.domain;

import java.io.Serializable;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "hotelimagelist")
public class Hotelimagelist implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 9118843289780280457L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "URL", length = 150)
	private String url;

	public String getUrl() {
		return this.url;
	}

	public void setUrl(String id) {
		this.url = id;
	}

	@Column(name = "EANHotelID")
	@NotNull
	private Integer eanhotelId;

	@Column(name = "Caption", length = 70)
	private String caption;

	@Column(name = "Width")
	private Integer width;

	@Column(name = "Height")
	private Integer height;

	@Column(name = "ByteSize")
	private Integer byteSize;

	@Column(name = "ThumbnailURL", length = 300)
	private String thumbnailUrl;

	@Column(name = "DefaultImage")
	private Short defaultImage;

	@Column(name = "TimeStamp")
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "MM")
	private Calendar timeStamp;

	public Integer getEanhotelId() {
		return eanhotelId;
	}

	public void setEanhotelId(Integer eanhotelId) {
		this.eanhotelId = eanhotelId;
	}

	public String getCaption() {
		return caption;
	}

	public void setCaption(String caption) {
		this.caption = caption;
	}

	public Integer getWidth() {
		return width;
	}

	public void setWidth(Integer width) {
		this.width = width;
	}

	public Integer getHeight() {
		return height;
	}

	public void setHeight(Integer height) {
		this.height = height;
	}

	public Integer getByteSize() {
		return byteSize;
	}

	public void setByteSize(Integer byteSize) {
		this.byteSize = byteSize;
	}

	public String getThumbnailUrl() {
		return thumbnailUrl;
	}

	public void setThumbnailUrl(String thumbnailUrl) {
		this.thumbnailUrl = thumbnailUrl;
	}

	public Short getDefaultImage() {
		return defaultImage;
	}

	public void setDefaultImage(Short defaultImage) {
		this.defaultImage = defaultImage;
	}

	public Calendar getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Calendar timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((byteSize == null) ? 0 : byteSize.hashCode());
		result = prime * result + ((caption == null) ? 0 : caption.hashCode());
		result = prime * result
				+ ((defaultImage == null) ? 0 : defaultImage.hashCode());
		result = prime * result
				+ ((eanhotelId == null) ? 0 : eanhotelId.hashCode());
		result = prime * result + ((height == null) ? 0 : height.hashCode());
		result = prime * result
				+ ((thumbnailUrl == null) ? 0 : thumbnailUrl.hashCode());
		result = prime * result
				+ ((timeStamp == null) ? 0 : timeStamp.hashCode());
		result = prime * result + ((url == null) ? 0 : url.hashCode());
		result = prime * result + ((width == null) ? 0 : width.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Hotelimagelist other = (Hotelimagelist) obj;
		if (byteSize == null) {
			if (other.byteSize != null)
				return false;
		} else if (!byteSize.equals(other.byteSize))
			return false;
		if (caption == null) {
			if (other.caption != null)
				return false;
		} else if (!caption.equals(other.caption))
			return false;
		if (defaultImage == null) {
			if (other.defaultImage != null)
				return false;
		} else if (!defaultImage.equals(other.defaultImage))
			return false;
		if (eanhotelId == null) {
			if (other.eanhotelId != null)
				return false;
		} else if (!eanhotelId.equals(other.eanhotelId))
			return false;
		if (height == null) {
			if (other.height != null)
				return false;
		} else if (!height.equals(other.height))
			return false;
		if (thumbnailUrl == null) {
			if (other.thumbnailUrl != null)
				return false;
		} else if (!thumbnailUrl.equals(other.thumbnailUrl))
			return false;
		if (timeStamp == null) {
			if (other.timeStamp != null)
				return false;
		} else if (!timeStamp.equals(other.timeStamp))
			return false;
		if (url == null) {
			if (other.url != null)
				return false;
		} else if (!url.equals(other.url))
			return false;
		if (width == null) {
			if (other.width != null)
				return false;
		} else if (!width.equals(other.width))
			return false;
		return true;
	}

}
